using System;
using System.Collections.Generic;
using System.Text;
using SchEdu.Framework.DataModel;
using SchEdu.Framework.Exceptions;

namespace SchEdu.Framework.Validators
{
    public class AllocationValidator : Validator
    {
        public AllocationValidator()
            :base()
        {
        }
        public AllocationValidator(SchEduData schEduData, SchEduDataSet.SolutionRow solution)
            : base(schEduData,solution)
        {
        }
        #region IValidator Members

        public override void Validate()
        {
            AllocationList allocations = new AllocationList(Solution.GetAllocationRows());
            if (allocations.Count == 0)
            {
                throw new ValidatorException(Resources.NoAllocations);
            }
            IValidator validator;
            validator = new AllocationOrderValidator(SchEduData, Solution);
            validator.Validate();
            validator = new AllocationProcessingTimeValidator(SchEduData, Solution);
            validator.Validate();
            validator = new AllocationOperationValidator(SchEduData, Solution);
            validator.Validate();
            validator = new AllocationWorkCenterValidator(SchEduData, Solution);
            validator.Validate();
            validator = new AllocationMachineValidator(SchEduData, Solution);
            validator.Validate();
            validator = new AllocationStartDateValidator(SchEduData, Solution);
            validator.Validate();
            validator = new AllocationEndDateValidator(SchEduData, Solution);
            validator.Validate();

        }

        #endregion
    }
}
